home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / AE Stuff / @Read Me next >
Encoding:
Text File  |  1994-11-30  |  6.4 KB  |  245 lines  |  [TEXT/KAHL]

  1. Contents:
  2.  
  3. -----------------------------------------
  4. AEUtilities.c:    some useful routines…
  5. AEUtilities.h:    the corresponding include
  6. -----------------------------------------
  7.  
  8.     OSErr GetTargetID(…)        : returns the targetID of an application
  9.     OSErr EntityPathToAlias(…)    : converts a full path name into an alias
  10.     OSErr GetProcessPSN(…)        : return the PSN of the specified application
  11.     OSErr KillProcess(…)        : Kill an application
  12.  
  13.  
  14. ----------------------------------------------------------
  15. CGenericAE.c:    the base class for building an apple event
  16. CGenericAE.h:    the corresponding include
  17. ----------------------------------------------------------
  18.  
  19.     //    to create the class simply issue
  20.     CGenericAE    *LcCAE = new(CGenericAE)    ;
  21.  
  22.     //    then you can either select a target using the PPCBrower()
  23.     //    (note that you must specified how you want the target to be
  24.     //    identified (PSN, TargetID, FileType and Creator, etc.):
  25.     LcOSErr = LcCAE->AskAndBuildTarget(sPSN) ;
  26.  
  27.     //    or directly specified the target.
  28.     //    For example:
  29.     LcOSErr = LcCAE->BuildTargetWithTypeAndSign(TheProcessType,
  30.                                                 TheProcessSignature);
  31.  
  32.     //    Once the target is valid, you build the event you want to send with:
  33.     LcOSErr = LcCAE->CreateAE(kCoreEventClass,kAEQuitApplication)    ;
  34.  
  35.     //    then you send the event (and here ask for a reply):
  36.     LcOSErr = LcCAE->SendAEWithReply() ;
  37.  
  38.  
  39. ---------------------------------------------------------------
  40. CFinderEvent.c:    the FinderEvent class (derived from CGenericAE)
  41. CFinderEvent.h:    the corresponding include
  42. ---------------------------------------------------------------
  43.  
  44.     //    To create the class simply issue:
  45.     CFinderEvent    *LcFinderEvent = new(CFinderEvent) ;
  46.  
  47.     //    To intialise it, you can either call (for your local finder):
  48.     LcOSErr = LcFinderEvent->IFinderEvent()    ;
  49.  
  50.     //    or (TheRemoteMachine can be NULL):
  51.     LcOSErr = LcFinderEvent->IRemoteFinderEvent(TheRemoteMachine)
  52.  
  53.     //    then simply choose the event you want to send (see below).
  54.     //    The following call display the finder about box:
  55.     LcFinderEvent->FESendAbout(void)
  56.  
  57.  
  58. The possible calls are:
  59. =======================
  60.  
  61.     /*
  62.      *    Displays the finder about dialog box
  63.      */
  64.     OSErr CFinderEvent::FESendAbout(void)
  65.  
  66.     /*
  67.      *    Creates an alias of the specified item(s) in the specified folder
  68.      *    (you can pass a list of files separated by a comma).
  69.      */
  70.     OSErr CFinderEvent::FESendAliasSelection(
  71.         Ptr    TheFolderPath,
  72.         Ptr    TheItemList)
  73.  
  74.     /*
  75.      *    Closes the finder about dialog box
  76.      */
  77.     OSErr CFinderEvent::FESendCloseAbout(void)
  78.  
  79.     /*
  80.      *    Closes the specified window, which can be a Folder window (kAEMain),
  81.      *    a GetInfo window (kAEInfo), or a Sharing window (kAESharing).
  82.      */
  83.     OSErr CFinderEvent::FESendCloseWindow(
  84.         Ptr            TheWindowPath,
  85.         WindowType    TheWindowType)
  86.  
  87.     /*
  88.      *    Copies one or more files (separated by a comma). The Position (HPos,VPos)
  89.      *    is the position in the folder!!! (I generally always choose (1,1))
  90.      */
  91.     OSErr CFinderEvent::FESendDragSelection(
  92.         Ptr        TheDestinationFolder,
  93.         Ptr        TheItemPathList,
  94.         short    TheHPos,
  95.         short    TheVPos)
  96.  
  97.     /*
  98.      *    Duplicates one or more files (separated by a comma).
  99.      */
  100.     OSErr CFinderEvent::FESendDuplicateSelection(
  101.         Ptr        TheFolderPath,
  102.         Ptr        TheItemList)
  103.  
  104.     /*
  105.      *    Empties the trash can.
  106.      */
  107.     OSErr CFinderEvent::FESendEmptyTrash(void)
  108.  
  109.     /*
  110.      *    Displays the GetInfo window of the specified items. To get info on a
  111.      *    disk, TheFolderPath must be empty, and TheItemList must contain the
  112.      *    disk's name with a colon at its end.
  113.      */
  114.     OSErr CFinderEvent::FESendGetInfo(
  115.         Ptr        TheFolderPath,
  116.         Ptr        TheItemList)
  117.  
  118.     /*
  119.      *    Closes the clipboard window.
  120.      */
  121.     OSErr CFinderEvent::FESendHideClipboard(void)
  122.  
  123.     /*
  124.      *    Drags one or more files (separated by a comma). The Position (HPos,VPos)
  125.      *    is the position in the folder!!! (I generally always choose (1,1))
  126.      */
  127.     OSErr CFinderEvent::FESendMoveSelection(
  128.         Ptr        TheDestinationFolder,
  129.         Ptr        TheItemPathList,
  130.         short    TheHPos,
  131.         short    TheVPos)
  132.  
  133.     /*
  134.      *    Sets the top left corner of the specified window to the specified point.
  135.      */
  136.     OSErr CFinderEvent::FESendMoveWindow(
  137.         Ptr        TheWindowPath,
  138.         short    TheHPos,
  139.         short    TheVPos)
  140.  
  141.     /*
  142.      *    Opens (launches) one or more files (separated by a comma)
  143.      *    in the specified folder.
  144.      *
  145.      *    You can open remote files if you used the IRemoteFinderEvent() call.
  146.      */
  147.     OSErr CFinderEvent::FESendOpenSelection(
  148.         Ptr        TheFolderPath,
  149.         Ptr        TheItemList)
  150.     {
  151.         RETURN(CreateAE(kAEFinderEvents,kAEOpenSelection))            ;
  152.         RETURN(protFolderPathPutParam(TheFolderPath))                ;
  153.         RETURN(protFilesListPutParam(TheFolderPath,TheItemList))    ;
  154.         return(SendAE(kAENeverInteract | kAENoReply))                ;
  155.     }
  156.  
  157.     /*
  158.      *    Brings the Page Setup dialo box.
  159.      */
  160.     OSErr CFinderEvent::FESendPageSetup(
  161.         Ptr TheWindowPath)
  162.  
  163.     /*
  164.      *    Prints the specified file(s).
  165.      *
  166.      *    You can print remote files if you used the IRemoteFinderEvent() call.
  167.      */
  168.     OSErr CFinderEvent::FESendPrintSelection(
  169.         Ptr        TheFolderPath,
  170.         Ptr        TheItemList)
  171.  
  172.     /*
  173.      *    Prints the current view of the specified window
  174.      */
  175.     OSErr CFinderEvent::FESendPrintWindow(
  176.         Ptr        TheWindowPath)
  177.  
  178.     /*
  179.      *    Brings the specified item(s) back to their original folder(s). The
  180.      *    items must be either on the desktop or in the trask.
  181.      */
  182.     OSErr CFinderEvent::FESendPutAway(
  183.         Ptr        TheFolderPath,
  184.         Ptr        TheItemList)
  185.  
  186.     /*
  187.      *    Sets the size of the specified window to the specified values.
  188.      */
  189.     OSErr CFinderEvent::FESendResizeWindow(
  190.         Ptr        TheWindowPath,
  191.         short    TheHeight,
  192.         short    TheWidth)
  193.  
  194.     /*
  195.      *    Restarts the machine.
  196.      */
  197.     OSErr CFinderEvent::FESendRestart(void)
  198.  
  199.     /*
  200.      *    Opens the specified window (TheFolderPath) and selects and hilites the
  201.      *    specified item(s).
  202.      */
  203.     OSErr CFinderEvent::FESendRevealSelection(
  204.         Ptr        TheFolderPath,
  205.         Ptr        TheItemList)
  206.  
  207.     /*
  208.      *    Changes the way the items are viewed in the specified window (by small
  209.      *    icon, by icon, by name, etc., see TypeWindowView in AERegistry.h).
  210.      */
  211.     OSErr CFinderEvent::FESendSetView(
  212.         Ptr                TheWindowPath,
  213.         TypeWindowView    TheWindowView)
  214.  
  215.     /*
  216.      *    Brings the Sharing dialog bow for the specified appl, disks or folders.
  217.      */
  218.     OSErr CFinderEvent::FESendSharing(
  219.         Ptr        TheParentPath,
  220.         Ptr        TheFolderList)
  221.  
  222.     /*
  223.      *    Displays the Clipboard window.
  224.      */
  225.     OSErr CFinderEvent::FESendShowClipboard(void)
  226.  
  227.     /*
  228.      *    Shuts down the machine.
  229.      */
  230.     OSErr CFinderEvent::FESendShutDown(void)
  231.  
  232.     /*
  233.      *    Puts the machine to sleep (assuming it is possible of course).
  234.      */
  235.     OSErr CFinderEvent::FESendSleep(void)
  236.  
  237.     /*
  238.      *    Zooms the window to the specified state (zoomIn or zoomOut).
  239.      */
  240.     OSErr CFinderEvent::FESendZoomWindow(
  241.         Ptr                TheWindowPath,
  242.         TypeWindowZoom    TheWindowZoom)
  243.  
  244.  
  245. That's all folks!